package com.wsp.controllermanagement.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;

/**
 * Package: com.wsp.controllermanagement.config
 * Description： TODO
 * @Author: 巫思平
 * Copyright: Copyright (c) 2020
 * Version: 1 
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket getDocket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(getaipInfor())
                .enable(true)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.wsp.controllermanagement.controller"))
                .paths(PathSelectors.any())
                .build()
                ;
    }

    @Bean
    public ApiInfo getaipInfor(){
        return new ApiInfo("简介", "api", "1.0", "urn:tos", new Contact("wsp", "null", "2753745213@qq.com"), "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0", new ArrayList());
    }
}
